

package com.czkt.filter;

import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.StringRedisTemplate;

import javax.annotation.Resource;

//
@Configuration
public class FilterRegister {

    @Resource
    StringRedisTemplate stringRedisTemplate;

    @Bean
//    @Order(1)
    public FilterRegistrationBean filterRegistrationBean(){

        FilterRegistrationBean registration = new FilterRegistrationBean();
        AutoFilter autoFilter=new AutoFilter();
        autoFilter.setStringRedisTemplate(stringRedisTemplate);
        registration.setFilter(autoFilter);
        registration.addUrlPatterns("/*");
        return registration;
    }

}
